const cloud = getApp().cloud;
const app = getApp();
Page({
  data: {},

  // 去首页
  goIndex(){
    my.reLaunch({url: '../index/index'})
  },

  // 去排行榜
  goList(){
    my.navigateTo({ url: '../vote/vote' })
  },

  // 去抽奖
  goLottery(){
    my.navigateTo({ url: '../lottery/lottery' })
  },

  //获取用户信息
  getUserInfo(){
    cloud.function.invoke('client',{},'getUserInfo').then(res => {
      console.log('resulte---获取用户信息',res);  
      this.setData({
        drawNum:res.data.drawNum
      })
    }) 
  },

  onLoad(query) {

    let i = 0;

    if(i==0){

      this.setData({
        sf:true,
      })

      setTimeout(()=>{

        this.setData({
          sf:false
        })

      },2000)

    }
    
    console.log(query.img);
    if(query.img){
      this.setData({
        img:query.img
      })
    }
    //获取用户信息
    this.getUserInfo();
  },

});
